// pages/shequ/shequ.ts
Page({
    data: {
        sum: 0,
        imgcurrent: 0,
        index:'',
        imageGroups: [
            {
                images: [
                    { url: "https://dimg04.c-ctrip.com/images/1me6k12000emlg9bi027D_W_800_0_Q90.jpg" },
                    { url: "https://dimg04.c-ctrip.com/images/1me3m12000eml7gxz60C9_W_800_0_Q90.jpg" },
                    { url: "https://dimg04.c-ctrip.com/images/1me4k12000eml9i1mEFAD_W_800_0_Q90.jpg" },
                    { url: "https://dimg04.c-ctrip.com/images/1me6212000emldvv8715E_W_800_0_Q90.jpg" },
                    { url: "https://dimg04.c-ctrip.com/images/1me1q12000emlci3w210C_W_800_0_Q90.jpg" },
                    { url: "https://dimg04.c-ctrip.com/images/1me4x12000emled6d3A01_W_800_0_Q90.jpg" },
                    { url: "https://dimg04.c-ctrip.com/images/1me5t12000eml9qts8937_W_800_0_Q90.jpg" },
                    { url: "https://dimg04.c-ctrip.com/images/1me5b12000emlc9ni7F1B_W_800_0_Q90.jpg" },
                    { url: "https://dimg04.c-ctrip.com/images/1me7312000eml293d2F96_W_800_0_Q90.jpg" }
                ]
            },
            {
                images: [
                    { url: "https://dimg04.c-ctrip.com/images/1me4k12000eml9i1mEFAD_W_800_0_Q90.jpg" },
                    { url: "https://dimg04.c-ctrip.com/images/1me6212000emldvv8715E_W_800_0_Q90.jpg" }
                ],
            },
            {
                images:[
                    { video:"https://video.c-ctrip.com/videos/1A0rcn14x8vdf1m3aBA31_smart.mp4"}
                ]
            }
        ],
    },
    // 在页面加载时获取单个images数组的长度并设置到页面数据中
    onLoad: function (options:any) {
        const indexs = options.index;
        // 计算总图片数
        const sumImages = this.data.imageGroups[options.index].images.length;
        console.log('传递的图片索引:', indexs);
        this.setData({ 
            index: indexs,
            sum: sumImages
        });
    },
    onSwiperChange: function (e) {
        // 获取当前的图片索引
        const current = e.detail.current;
        console.log('当前索引:', current);
        // 更新页面数据
        this.setData({
            imgcurrent: current,
        });
    },
    navigateBack() {
        // 返回上一级页面
        wx.navigateBack();
    },
    onReady() { },
    onShow() { },
    onHide() { },
    onUnload() { },
    onPullDownRefresh() { },
    onReachBottom() { },
    onShareAppMessage() { }
});